//
// Created by mio on 25-5-7.
//

#ifndef LOADDEFINE_H
#define LOADDEFINE_H

#include <cstdint>
#include <array>
#include <string>

#include "../LoginServer/define.h"

#pragma pack(push,1)
// 登录
struct Login_Info : public packet_head
{
    Login_Info() : packet_head()
    {
        cmd = LOGIN;
        len = sizeof(Login_Info);
    }
    uint64_t timestamp;
};

// 登录应答
struct LoginReply : public packet_head
{
    LoginReply() : packet_head()
    {
        cmd = LOGIN;    // 如果请求超时，将这个cmd置为ERROR
        len = sizeof(LoginReply);
        port = -1;
        ip.fill('\0');
    }
    uint16_t port;
    std::array<char, 16> ip;
};


typedef std::pair<int, Monitor_body*> MonitorPair;

struct CmpByVale
{
    bool operator()(const MonitorPair& l, const MonitorPair& r)
    {
        return l.second->mem < r.second->mem; // 排序, 从小到达排序
    }
};

#pragma pack(pop)

#endif //DEFINE_H
